package com.billdowney.vo.system.quartz;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.billdowney.annotation.quartz.JobClassParam;
import com.billdowney.util.CommonUtil;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 添加到调度器中的JobDetail{@link org.quartz.JobDetail}
 * 
 * @author 超级小富翁
 * @date 2019年9月5日 下午7:42:17
 */
@ApiModel(description = "JobDetail的信息")
public class JobDetailInfoVO implements Serializable {

	private static final long serialVersionUID = 1L;
	@ApiModelProperty(value = "作业名称")
	private String jobName;
	@ApiModelProperty(value = "作业组名称")
	private String jobGroup;
	@ApiModelProperty(value = "作业类")
	private String jobClass;
	@ApiModelProperty(value = "作业描述")
	private String jobDesc;
	@ApiModelProperty(value = "参数列表")
	private List<Param> paramList;

	public JobDetailInfoVO() {
		this.paramList = new ArrayList<Param>();
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getJobClass() {
		return jobClass;
	}

	public void setJobClass(String jobClass) {
		this.jobClass = jobClass;
	}

	public String getJobDesc() {
		return jobDesc;
	}

	public void setJobDesc(String jobDesc) {
		this.jobDesc = jobDesc;
	}

	public List<Param> getParamList() {
		return paramList;
	}

	public void setParamList(List<Param> paramList) {
		this.paramList = paramList;
	}

	public void addParamList(JobClassParam... paramList) {
		if (CommonUtil.isNotEmpty(paramList)) {
			for (JobClassParam jobClassParam : paramList) {
				Param param = new Param();
				param.setName(jobClassParam.name());
				param.setDesc(jobClassParam.desc());
				param.setType(jobClassParam.type().getName());
				this.paramList.add(param);
			}
		}
	}
}

/**
 * 作业可以接受的参数
 * 
 * @author 超级小富翁
 * @date 2019年9月5日 下午10:54:50
 */
@ApiModel(description = "JobDetail可以接受的参数")
class Param implements Serializable {

	private static final long serialVersionUID = 1L;
	@ApiModelProperty(value = "参数名")
	private String name;
	@ApiModelProperty(value = "参数描述")
	private String desc;
	@ApiModelProperty(value = "参数类型")
	private String type;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
}
